package com.myk.game.gobangchess.ai.gravityfour;

public class KillJudging2plus {
    public static int[] killJudgingDeep2(int[][] board, int direction, int player_turn, int dir_changed) {
        int[] result = new int[3];
        int iskill_deep2 = 0;
        int killpoint = -1;
        int killdeep = -1;
        int player_num = (player_turn == 1) ? 1 : 2;

        int[] iskill = KillJudging.killJudgingDeep1(board);

        if (iskill[player_num - 1] == 1) {
            iskill_deep2 = 1;
            killdeep = 1;
        } else {
            for (int x = 1; x <= 10; x++) {
                Object[] pointSettingResult = PointSetting.pointSetting(board, direction, player_turn, x, dir_changed);
                int set_succ = (int) pointSettingResult[0];
                int[][] new_board = (int[][]) pointSettingResult[1];
                if (set_succ == 1) {
                    iskill = KillJudging.killJudgingDeep1(new_board);
                    if (iskill[player_num - 1] == 1) {
                        iskill_deep2 = 1;
                        killdeep = 2;
                        killpoint = x;
                        break;
                    }
                }
            }
        }

        result[0] = iskill_deep2;
        result[1] = killpoint;
        result[2] = killdeep;
        return result;
    }
}
